<template>
	<view>
		<view class="analysis_box" v-if="!analysis_finish">
			<view class="box_1" v-if="show">
				<view class="item over" :class="'item'+parseInt(index+1)" v-for="(item,index) in module_list"
					:key="index">
					{{item}}
					<view class="txt">完成</view>
				</view>
			</view>
			<view class="box_2">根据您的简历完整度</view>
			<view class="box_2 pd">正在为您计算求职竞争力</view>
			<view class="box_3">
				<u-slider v-model="percent" bar-height="8px" active-color="#3196ff" inactive-color="#cce5ff"
					button-size="16px" />
			</view>
		</view>
		<view class="finish_box" v-if="analysis_finish">
			<!-- <Head>创建完成</Head> -->
			<view class="top_bg">
				<!-- <image :src="imgUrl + 'over_ico_green.svg'"></image> -->
			</view>
			<view class="txt_1">您的求职竞争力 <text class="level_low">较低</text></view>
			<view class="txt_2">请继续完善简历，助您快速高效面试</view>
			<view style="margin: 46rpx;">
				<u-button type="primary" shape="circle" @click="handleClick('/personal/EditResume')">继续完善</u-button>
			</view>
			<view style="margin: 46rpx;">
				<u-button :plain="true" shape="circle" type="primary" @click="handleClick('/personal/PersonalIndex')">
					会员中心</u-button>
			</view>
		</view>
	</view>
</template>

<script>
	import http from '@/utils/http'
	import api from '@/api'
	export default {
		name: 'AddResumeFinish',
		data() {
			return {
				show: false,
				analysis_finish: false,
				percent: 0,
				module_list: [],
				imgUrl: getApp().globalData.imgUlr,
			}
		},
		mounted() {
			this.initInfo()
		},
		methods: {
			handleClick(path) {
				uni.redirectTo({
					url: path
				})
			},
			initInfo() {
				http.get(api.resume_complete_info, {})
					.then(res => {
						this.module_list = res.data.data.module
						this.show = true
						setTimeout(() => {
							this.handlerPercent()
						}, 1200)
					})
					.catch(() => {})
			},
			handlerPercent() {
				let that = this
				let plus = 80
				let t = setInterval(function() {
					plus = plus / 2
					if (plus <= 1) {
						plus = 1
					}
					that.percent += plus
					if (that.percent >= 100) {
						clearInterval(t)
						that.analysis_finish = true
					}
				}, 100)
			}
		}
	}
</script>

<style lang="scss" scoped>
	@keyframes leftIn {
		from {
			transform: translateX(-300rpx);
			opacity: 0;
		}

		to {
			transform: translateX(0px);
			opacity: 1;
		}
	}

	.analysis_box {
		.van-slider__button {
			background-color: #1787fb;
		}

		.box_3 {
			width: 510rpx;
			margin: 0 auto;
		}

		.box_2 {
			font-size: 32rpx;
			font-weight: bold;
			color: #333333;
			text-align: center;

			&.pd {
				padding: 20rpx 0 70rpx;
			}
		}

		.box_1 {
			.item {
				&.item1 {
					animation: leftIn 0.3s ease;
				}

				&.item2 {
					animation: leftIn 0.8s ease;
				}

				&.item3 {
					animation: leftIn 1.2s ease;
				}

				&.item4 {
					animation: leftIn 1.2s ease;
				}

				&.item5 {
					animation: leftIn 1.2s ease;
				}

				&.item6 {
					animation: leftIn 1.2s ease;
				}

				&.ing {
					box-shadow: 0 0 10rpx #e2ebff;
				}

				&.over {
					&::before {
						background-color: #1787fb;
						border: 4rpx solid #c5e1fe;
					}

					&::after {
						content: " ";
					}
				}

				&::after {
					position: absolute;
					right: 80rpx;
					top: 22rpx;
					width: 34rpx;
					height: 34rpx;
					// background: url("../../assets/images/over_ico_green.svg") 0 no-repeat;
					background-size: 34rpx;
				}

				.txt {
					position: absolute;
					right: 140rpx;
					top: 24rpx;
					font-size: 30rpx;
					color: #333333;
				}

				&::before {
					content: " ";
					position: absolute;
					left: 78rpx;
					top: 50%;
					transform: translate(0, -50%);
					width: 10rpx;
					height: 10rpx;
					border-radius: 100%;
					background-color: #999999;
					border: 4rpx solid #e5e5e5;
				}

				position: relative;
				width: 610rpx;
				margin: 0 auto;
				border-radius: 10rpx;
				font-size: 30rpx;
				color: #333333;
				padding: 24rpx 0 24rpx 114rpx;
			}

			width: 100%;
			padding-top: 112rpx;
			margin-bottom: 142rpx;
		}
	}

	.finish_box {
		.top_bg {
			width: 100%;
			height: 356rpx;
			background-image: url(../static/img/add_resume_finish_bg.png);
			// background: url("../../assets/images/add_resume_finish_bg.png") center 106rpx no-repeat;
			background-repeat: no-repeat;
			background-position: center 106rpx;
			background-size: 211rpx 205rpx;

			image {
				width: 100%;
				height: 100%;
				margin: 0 auto;
				display: block;
			}
		}

		.txt_1 {
			text-align: center;
			font-size: 36rpx;
			color: #333333;
			font-weight: bold;

			.level_low {
				color: #ff5d24;
			}
		}

		.txt_2 {
			text-align: center;
			font-size: 36rpx;
			color: #666666;
			padding: 30rpx 0 70rpx;
		}
	}
</style>
